<?php

namespace app\api\controller\ai;

use app\common\controller\BaseController;
use app\common\service\ai\SpeakerService;
use hg\apidoc\annotation as Apidoc;

/**
 * @Apidoc\Title("音色管理")
 * @Apidoc\Group("ai")
 * @Apidoc\Sort("300")
 */
class Speaker extends BaseController {
    
    /**
     * 表名
     * @static string
     */
    protected static $table = 'speaker';
    
    /**
     * @Apidoc\Title("列表")
     * @Apidoc\Param(ref="app\common\model\ai\SpeakerModel", field="member_id")
     * @Apidoc\Returned("list", type="array", desc="列表", children={
     * @Apidoc\Returned(ref="app\common\model\ai\SpeakerModel", withoutField="sdc"),
     * })
     */
    public function getList() {
        $list = SpeakerService::getList();
        return success($list);
    }
    
    /**
     * @Apidoc\Title("训练")
     * @Apidoc\Method("POST")
     * @Apidoc\Param(ref="app\common\model\ai\SpeakerModel", field="member_id,url")
     * @Apidoc\Param(ref="app\common\model\ai\AiVoiceModel", field="speaker_id")
     */
    public function train() {
        return SpeakerService::train($this->data);
    }
    
    /**
     * @Apidoc\Title("下拉列表")
     * @Apidoc\Param(ref="app\common\model\ai\SpeakerModel", field="member_id")
     * @Apidoc\Returned("list", type="array", desc="列表", children={
     * @Apidoc\Returned(ref="app\common\model\ai\SpeakerModel", withoutField="sdc"),
     * })
     */
    public function getListBySelect() {
        $list = SpeakerService::getListBySelect($this->data);
        return success($list);
    }
    
    /**
     * @Apidoc\Title("新增")
     * @Apidoc\Method("POST")
     * @Apidoc\Param(ref="app\common\model\ai\SpeakerModel", field="member_id,title,url")
     */
    public function add() {
        return SpeakerService::add($this->data);
    }

}
